<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>下拉菜单案例</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }



        .warp {
            width: 330px;
            height: 30px;
            margin: 200px auto;
            padding-left: 10px;
            background-color: cyan;

        }

        .warp>ul>li {
            float: left;
            margin-left: 10px;
            position: relative;
        }

        .warp a {
            display: block;
            height: 30px;
            width: 100px;
            text-decoration: none;
            color: black;
            line-height: 30px;
            text-align: center;
        }

        .warp li ul {
            position: absolute;
            top: 30px;
            display: none;
            background-color: cyan;
        }
    </style>
</head>
<script src="../jquery-1.12.4.js"></script>
<script>
    $(function () {
        var $lis = $("li");
        $lis.mouseover(function () {
            //console.log("hehe");
         $(this).children("ul").show();
        });

        $lis.mouseout(function(){
$(this).children("ul").hide();
        });
    });
</script>

<body>
    <div class="warp">
        <ul>
            <li>
                <a href="javascript:;">一级菜单1</a>
                <ul class="ul">
                    <li><a href="javascript:;">二级菜单11</a></li>
                    <li><a href="javascript:;">二级菜单12</a></li>
                    <li><a href="javascript:;">二级菜单13</a></li>
                </ul>
            </li>
            <li>
                <a href="javascript:;">一级菜单2</a>
                <ul class="ul">
                    <li><a href="javascript:;">二级菜单21</a></li>
                    <li><a href="javascript:;">二级菜单22</a></li>
                    <li><a href="javascript:;">二级菜单23</a></li>
                </ul>
            </li>
            <li>
                <a href="javascript:;">一级菜单3</a>
                <ul class="ul">
                    <li><a href="javascript:;">二级菜单31</a></li>
                    <li><a href="javascript:;">二级菜单32</a></li>
                    <li><a href="javascript:;">二级菜单33</a></li>
                </ul>
            </li>
        </ul>


    </div>
</body>

</html>